package com.tvein.sanguo.room.controller
{
	//flash
	//pureMVC
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
	//custom
	import com.tvein.sanguo.room.common.GameConstants;
	import com.tvein.sanguo.room.model.SystemProxy;
	import com.tvein.sanguo.room.view.RoomMediator;
//
	public class RoomScript extends SimpleFabricationCommand implements ICommand
	{
		private var systemData:SystemProxy;
		private var roomMediator:RoomMediator;
		
		override public function execute(notification:INotification) : void
		{
			systemData = facade.retrieveProxy(SystemProxy.NAME) as SystemProxy;
			roomMediator = facade.retrieveMediator(RoomMediator.NAME) as RoomMediator;
			
			roomMediator.roomShell.clearButton();
			
			var jso:Object = notification.getBody();
			var roomButton:Object = new Object();
			
			for (var i:int = 0; i < jso.Process.length; i++)
			{
				roomButton.Name = jso.Process[i].title;
				roomButton.Type = jso.Process[i].skillType;
				roomButton.CMD = jso.Process[i].cmd;
				roomButton.isVisible = true;
				
				roomMediator.roomShell.console("addButton", roomButton);
			}
		}
	}
}